package cn.xf.service.impl;

import cn.xf.dao.IPermissionDao;
import cn.xf.domain.Permission;
import cn.xf.service.IPermissionService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author xiaofu
 * @date 2021-05-18 12:23
 * @email dearaf@163.com
 */
@Service
@Transactional
public class PermissionServiceImpl implements IPermissionService {

    @Autowired
    private IPermissionDao permissionDao;
    @Override
    public List<Permission> findAll() {
        return permissionDao.findAll();
    }

    @Override
    public void save(Permission permission) {
        permissionDao.save(permission);
    }

    @Override
    public List<Permission> findOtherPermission(String roleId) {
        return permissionDao.findOtherPermission(roleId);
    }

    @Override
    public List<Permission> findAllByPage(Integer page, Integer pageSize) {
        PageHelper.startPage(page,pageSize);
        return permissionDao.findAll();
    }
}
